import React from 'react'
class MyChildComp1 extends React.Component {
  props: any
  componentDidMount () {
    console.log('MyChildComp1 挂载完成')
  }
  componentWillUnmount() {
    console.log('MyChildComp1 将要卸载')
  }
  shouldComponentUpdate() {
    console.log('MyChildComp1 将要更新')
    return true
  }
  componentDidUpdate() {
    console.log('MyChildComp1 更新完成')
    return true
  }
  render() {
    return <div>
      <h3>MyChildComp1 {this.props.n}</h3>
     
    </div>
  }
}

export default class MyComp1 extends React.Component {
  props: any
  constructor(props: any) {
    super(props)
  }
  componentDidMount () {
    console.log('MyComp1 挂载完成')
  }
  componentWillUnmount() {
    console.log('MyComp1 将要卸载')
  }
  shouldComponentUpdate() {
    console.log('MyComp1 将要更新')
    return true
  }
  componentDidUpdate() {
    console.log('MyComp1 更新完成')
    return true
  }
  render() {
    return <div>
      <h1>MyComp1</h1>
      <MyChildComp1 n={this.props.title}/>
    </div>
  }
}